using System;

namespace PHSRAG.Insight21.FormsManagement.Serialization
{
	/// <summary>
	/// FormItemProperty class is a serializable version of the ItemProperty class
	/// </summary>
	public class FormItemProperty : System.ICloneable
	{
		#region Private instance variables
		private string attributeName = string.Empty;
		private string attributeValue = string.Empty;
		#endregion

		#region Properties
		/// <summary>
		/// Gets or sets the name of the attribute
		/// </summary>
		public string AttributeName
		{
			get { return attributeName; }
			set { attributeName = value; }
		}

		/// <summary>
		/// Gets or sets the value of the attribute
		/// </summary>
		public string AttributeValue
		{
			get { return attributeValue; }
			set { attributeValue = value; }
		}
		#endregion

		#region Constructors
		/// <summary>
		/// Default Constructor required while serializing the object
		/// </summary>
		public FormItemProperty()
		{
		}


		/// <summary>
		/// Constructs a FormItemProperty out of the ItemProperty object passed in as a paramter
		/// </summary>
		/// <param name="o">ItemProperty object from which the FormItemProperty objects needs to be constructed</param>
		public FormItemProperty(ItemProperty o)
		{
			string itemProperty = o.AttributeName;
			attributeName = (itemProperty == null) ? string.Empty : itemProperty;
			itemProperty = o.AttributeValue;
			attributeValue = (itemProperty == null) ? string.Empty : itemProperty;
		}
		#endregion

		#region ICloneable Members
		/// <summary>
		/// Explicit interface method implementation - available for 
		/// clients of ICloneable, but invisible to other
		/// clients of FormItemProperty class
		/// </summary>
		/// <returns>FormItemProperty clone as a generic object</returns>
		object ICloneable.Clone()
		{
			return Clone();
		}


		/// <summary>
		/// Deep copies the FormItemProperty object
		/// </summary>
		/// <returns>The new FormItemProperty object after cloning</returns>
		public FormItemProperty Clone()
		{
			return (FormItemProperty)MemberwiseClone();
		}
		#endregion
	}
}
